package cn.uniqueinfo.dp.controller;

import cn.uniqueinfo.dp.controller.base.BaseController;
import cn.uniqueinfo.dp.service.ITableColumnService;
import cn.uniqueinfo.dp.vo.TableColumnVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author:朱元勋
 * @mail:395910063@qq.com
 * @date:2019-01-23 09:21:34
 * @description:物理表字段信息
 */
@Slf4j
@Controller
@RequestMapping(value = "/tablecolumn")
public class TableColumnController extends BaseController<TableColumnVO> {
    private ITableColumnService service;

    public TableColumnController(ITableColumnService service) {
        this.service = service;
        this.baseService = service;
        this.ctlName = "tablecolumn";
        this.tipName = "物理表字段信息";
    }

    @GetMapping("/colinfo")
    @ResponseBody
    public List<TableColumnVO> colInfo(@RequestParam(name = "tn",required = true) String tableName) {
        this.checkPermission("colInfo","colinfo");
        return this.service.findColumnsByTableName(tableName);
    }
}
